package com.controladores.controlvehicular;

import java.io.DataInputStream;
import java.io.IOException;

import android.util.Log;

public class ManejaEntrada implements Runnable{
    DataInputStream entrada;
    MainActivity principal;


  public ManejaEntrada(DataInputStream entrada,MainActivity principal) {
	this.entrada = entrada;
	this.principal = principal;
}  
	public void run() {
		Log.v(getClass().getCanonicalName(),"Iniciando hilo");
		while(true){
		try {
			String recibe = entrada.readUTF();
			if(recibe!=null){
				principal.Log("Recibiendo... "+recibe);
				Log.v(getClass().getCanonicalName(),"Recibiendo datos.."+recibe);
			}
			delay(1000);

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		}

}
	private void delay(long tiempo) {
		try {
			Thread.sleep(tiempo);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

